package gapidt.plugin.preferencepages;

import gapidt.common.Locale;
import gapidt.plugin.GapidtActivator;

import org.apache.log4j.Logger;
import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.ScaleFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

public class MainPreferencePage extends FieldEditorPreferencePage implements
		IWorkbenchPreferencePage {
	
	public static final String ID = MainPreferencePage.class.getCanonicalName(); 

	static Logger logger = Logger.getLogger(MainPreferencePage.class);
	
	@Override
	public void init(IWorkbench workbench) {
		setPreferenceStore(GapidtActivator.getDefault().getPreferenceStore());
		setDescription(Locale.getMessage(ID+".description"));
	}

	@Override
	protected void createFieldEditors() {
		
		addField(new ScaleFieldEditor(
				GapidtActivator.MIN_SIMILARITY_DEGREE_PREFERENCE,
				GapidtActivator.getPreferenceLabel(GapidtActivator.MIN_SIMILARITY_DEGREE_PREFERENCE),
				getFieldEditorParent(),
				0, //Min
				100, //Max
				1, //Increment
				1 //Page increment
				));
		
		addField(new StringFieldEditor(
				GapidtActivator.WHATEVER_TYPES_PREFERENCE, 
				GapidtActivator.getPreferenceLabel(GapidtActivator.WHATEVER_TYPES_PREFERENCE),
				50, //Width
				getFieldEditorParent()));
		
		addField(new StringFieldEditor(
				GapidtActivator.UNDERCOVER_FAULT_NAMES_PREFERENCE, 
				GapidtActivator.getPreferenceLabel(GapidtActivator.UNDERCOVER_FAULT_NAMES_PREFERENCE),
				50, //Width
				getFieldEditorParent()));
		
		addField(new StringFieldEditor(
				GapidtActivator.AMBIGUOUS_NAMES_PREFERENCE, 
				GapidtActivator.getPreferenceLabel(GapidtActivator.AMBIGUOUS_NAMES_PREFERENCE),
				50, //Width
				getFieldEditorParent()));
	}
	
}
